package com.example.serviceheadlines.feign;

import com.example.serviceheadlines.service.IHeadlinesCommentService;
import com.tangyuan.dto.UpdateHeadlinesDto;
import com.tangyuan.feignapis.headlines.IHeadlinesCommentFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HeadlinesCommentFeignClient implements IHeadlinesCommentFeignClient {

    @Autowired
    private IHeadlinesCommentService headlinesCommentService;

    @PostMapping("/feignApi/headlinesComment/updateHeadlinesCommentName")
    @Override
    public void updateHeadlinesCommentName(@RequestBody UpdateHeadlinesDto updateHeadlinesDto) {
        headlinesCommentService.updateHeadlinesCommentName(updateHeadlinesDto.getNickName(),updateHeadlinesDto.getUserId());
    }

    @PostMapping("/feignApi/headlinesComment/updateHeadlinesCommentAvatar")
    @Override
    public void updateHeadlinesCommentAvatar(@RequestBody UpdateHeadlinesDto updateHeadlinesDto) {
        headlinesCommentService.updateHeadlinesCommentAvatar(updateHeadlinesDto.getUrl(),updateHeadlinesDto.getUserId());
    }
}
